<?php

namespace Admin\Controller;
use Think\Controller;

class ConfigController extends CommonController{
	public function index() {
		$this->display();
	}

	public function save() {
		if(IS_POST) {
			$file = COMMON_PATH . 'Conf/siteConf.php';
			$config = array_merge( include $file, array_change_key_case( $_POST,CASE_UPPER ) );
		    $str = "<?php\r\nreturn " . var_export($config,true) .";\r\n?>";
		    if(!file_put_contents($file,$str)){
		    	$this->error('修改失败！');
		    }else{
		    	$this->success('修改成功！');
		    }
		}else{
			E('非法操作！');
		}
	}
}